
var media = ['./pic/1.bmp','./pic/2.bmp'];
var nowmedia = 0;
var nshow_time = 5000;

function OnInitPic(nShowTime, szFileList)
{

    f=setInterval(myPlay, nshow_time); //轮播图片
}
OnInitPic();
function myPlay(){
    console.log('myplay'+new Date().getTime())
    if(nowmedia<media.length){
        console.log('if'+new Date().getTime())
        s=media[nowmedia++];
        s += "?show="+Math.random();

    }else {
        console.log('else'+new Date().getTime())
        clearInterval(f);

        setTimeout(resume,5000)
    }
    console.log(nowmedia,s+new Date().getTime());

}
function OnMsg(msg)
{

    switch(msg)
    {
        case '32769':
            //MediaPlayer1.settings.volume = 100;
            MediaPlayer1.settings.mute = false;
            break;
        case '32770':
            //MediaPlayer1.settings.volume = 0;
            MediaPlayer1.settings.mute = true;
            break;
        default:
            break;
    }
}

function Init()
{
}


function play_pic()
{
    var s = nextmedia();


    //xiaoxiong 20170418
    if (nowmedia>media.length){
        clearInterval(f);
        MediaPlayer1.controls.play();
        setTimeout(resume,5000)
    }else {
        s += "?show="+Math.random();
        img.src = s;
    }

}

function resume(){
    console.log('resume'+new Date().getTime())
    nowmedia = 0;
    f=setInterval(play_pic, nshow_time); //轮播图片

}
//默认播放
function nextmedia()
{
    //nowmedia++;
    if(nowmedia >= media.length)
    {
        nowmedia = 0;
    }
    return media[nowmedia++];
}